package com.tanhua.manager.interceptor;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author anshuai
 * @create 2021-02-20 16:20
 */
@Configuration
public class WebConfig implements WebMvcConfigurer {

    @Autowired
    private TokenInterceptor tokenInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {

        registry.addInterceptor(tokenInterceptor)
                //将拦截器应用到所有请求路径
                .addPathPatterns("/**")
                //排除部分路径
                .excludePathPatterns("/system/users/verification", "/system/users/login");
    }
}
